import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

/**
 * ui基础类，所有的ui面板类型节点都要继承它
 */
@ccclass('UIBase')
export class UIBase extends Component {
    protected _disableCall: Function | null = null;
    public show (...args: any) {

    }

    /**
     * 设置隐藏回调
     * @param disableCall 
     */
    public setDisableCall (disableCall: Function | null) {
        this._disableCall = disableCall;
    }

    onDisable () {
        this._disableCall && this._disableCall();
    }

    /**
     * 关闭
     */
    onClose () {
        this.scheduleOnce(() => {
            this.node.active = false;
        })
    }
}

